<template>
    <div class="main">
        <div style="position:absolute; width:100%;height:100%;background-color: rgba(0, 0, 0, 0.3);z-index:5"></div>
        <img src="@/assets/凶猛的狼.png" style="width: 100%;height:190%;position:absolute;top:-50%;" />
        <TopMain class="top" />
        <RouterView style="position:absolute;z-index:5;width:100%;height:100%;" />
    </div>
    <AppMain style="z-index:1000" />
</template>
<script lang="ts" setup>
import AppMain from '@/components/AI/AppMain.vue'
import TopMain from '@/components/home/TopMain.vue'
import axios from 'axios'
import { ElMessage, ElMessageBox } from 'element-plus'
import { onMounted } from 'vue';
import { useStore } from 'vuex'
const store = useStore();
import { serverAddress } from '@/config'
onMounted(() => {
    axios({
        url: 'https://apifoxmock.com/m2/4743995-0-default/192728289',
        // url:`${serverAddress}/user/login`
        method: 'POST',
        data: {
            userEmail: sessionStorage.getItem('Account'),
            userPassword: sessionStorage.getItem('Password'),
        }
    }).then((response) => {
        if (response.data.code === 1) {
            sessionStorage.setItem('Head', response.data.data.userHead)
            store.state.UserInformation.Head = response.data.data.userHead
            sessionStorage.setItem('Name', response.data.data.userName);
            store.state.UserInformation.Name = response.data.data.userName
            sessionStorage.setItem('Account', response.data.data.userEmail)
            store.state.UserInformation.Account = response.data.data.userEmail
            sessionStorage.setItem('JWT', response.data.data.userJWT)
            store.state.UserInformation.JWT = response.data.data.userJWT
            sessionStorage.setItem('ID', response.data.data.userId)
            store.state.UserInformation.Id = response.data.data.userId
        } else {
            ElMessage({
                message: '加载失败1',
                type: 'warning',
            })
        }
    }).catch((error) => {
        ElMessage({
            message: '加载失败2',
            type: 'warning',
        })
    })
})
</script>
<style scoped>
.main {
    position: absolute;
    top: 0px;
    left: 0px;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.top {
    position: absolute;
    top: 0px;
    width: 100%;
    height: 65px;
    z-index: 10;
    border-radius: 0px;
}
</style>